<template>
  <tr>
    <td><input type="checkbox" :checked="item.checked" @input="cc" /></td>
    <td>{{ item.name }}</td>
    <td>{{ item.price }}</td>
    <td>
      <button @click="subtractFn({index,num:-1})">-</button>
      {{ item.num }}
      <button @click="subtractFn({index,num:1})">+</button>
    </td>
    <td>{{item.price*item.num}}</td>
    <td><button @click="del">删除</button></td>
  </tr>
</template>

<script>
import { mapMutations} from "vuex";                                                    
export default {
  props: ['item','index'],
  methods: {
    ...mapMutations("shop", ["dell",'subtractFn','isAll']),
    //删除
    del() {
      this.dell();
    },
    //全选
    cc(){
    // this.$emit('value',val)
    this.$store.commit('shop/isAll',this.index)
    },
  },
};
</script>

<style></style>
